﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_Controls_DimensionSelector : System.Web.UI.UserControl
{
    #region Properties

    public bool IsDimensionVisible { get; set; }

    public bool IsBackSplashEnabled { get; set; }

    public string sideName { get; set; }

    #endregion Properties

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lblSide.Text += sideName;
            rblSideType.DataSource = BLL.Common.GetSideType();
            rblSideType.DataTextField = "Name";
            rblSideType.DataValueField = "Id";
            rblSideType.DataBind();
        }
        EnsureVisibility();
    }

    private void EnsureVisibility()
    {
        txtDimension.Visible = true;
        rblSideType.Visible = true;
        cbBacksplash.Enabled = true;

        if (!IsDimensionVisible)
        {
            txtDimension.Enabled = false;
            txtDimension.ToolTip = "Will be calculated automatically";
        }

        if (!IsBackSplashEnabled)
        {
            cbBacksplash.Enabled = false;
            cbBacksplash.Checked = false;
        }
    }

}
